package org.vshe.improve.spring.prospring3.ch7.aspectjannotation;

import java.lang.reflect.Method;

import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.aop.MethodBeforeAdvice;
import org.springframework.stereotype.Component;

@Component
@Aspect
public class MyAdvice{
	@Pointcut("execution(* org.vshe.improve.spring.prospring3.ch7.aspectjannotation..foo*(int)) && args(intValue)")
	public void fooExecution(int intValue) {}
	
	
	@Before("fooExecution(intValue)")	
	public void simpleBeforeAdvice(JoinPoint joinPoint, int intValue)
			throws Throwable {
		if (intValue != 100) {
		System.out.println("Executing: " + joinPoint.getSignature().getDeclaringTypeName() 
				+ " " 
				+ joinPoint.getSignature().getName());
		}
	}
	
}
